package com.beans;

public class SimpleCalculator {
    private float first = 0.0f;
    private float second = 0.0f;
    private String operator;
    private float result;

    public SimpleCalculator() {

    }

    public SimpleCalculator(float first, float second, String operator) {
        this.first = first;
        this.second = second;
        this.operator = operator;
    }

    public float calculator() {
        if (this.operator != null)
            switch (this.operator) {
                case "*":
                    this.result = this.first * this.second;
                    break;
                case "/":
                    this.result = this.first / this.second;
                    break;
                case "-":
                    this.result = this.first - this.second;
                    break;
                case "+":
                    this.result = this.first + this.second;
                    break;
            }
        return this.result;
    }

    public float getFirst() {
        return this.first;
    }

    public float getSecond() {
        return this.second;
    }

    public String getOperator() {
        return this.operator;
    }

    public void setFirst(float first) {
        this.first = first;
    }

    public void setSecond(float second) {
        this.second = second;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public float getResult() {
        return this.result;
    }
}
